import request from '@/utils/request'

// 获取广告列表
export function listPopUpNotification(query) {
    return request({
        url: '/setting/ads',
        method: 'get',
        params: query
    })
}
// 新增广告表
export function addPopUpNotification(data) {
    return request({
        url: '/setting/ads',
        method: 'post',
        data: data
    })
}

// 修改广告表
export function updatePopUpNotification(data) {
    return request({
        url: '/setting/ads',
        method: 'put',
        data: data
    })
}

// // 删除广告表
export function delPopUpNotification(ids) {
    return request({
        url: '/setting/ads/' + ids + '/batch',
        method: 'delete'
    })
}

//修改广告表启用状态
export function handleEnabledChange(id, enabled) {
    const data = {
        enabled
    }
    return request({
        url: '/setting/ads/' + id + '/enabled',
        method: 'put',
        data: data
    })
}
//修改广告时间
export function handleTimeChange(id, startTime, endTime){
  const data = {
    startTime: startTime,
    endTime: endTime
  }
  return request({
    url: '/setting/ads/' + id + '/time',
    method: 'put',
    data: data
  })
}
//更换图片
export function handleImageChange(id, data){
  return request({
    url: '/setting/ads/' + id + '/image',
    method: 'put',
    data: data
  })
}
